﻿hal.Create.Class(null, "exp.RichCanvas", null, "exp.SearchBox", {
    __defaults__: { txtStyle: "width:150px;height:25px;", btnStyle: "height:25px;width:60px;border:solid 1px gray;margin-left:10px;", btnTxt: "検索" },
    init: function(container, props) {
        exp.RichCanvas.prototype.init.apply(this, arguments);
        this.drawParts();
    },
    drawParts: function() {
        var ip = this.inputBox = document.createElement("input");
        ip.type = "text";
        ip.style.cssText += ";" + this.txtStyle;
        var bt = this.searchButton = document.createElement("button");
        bt.style.cssText += ";" + this.btnStyle;
        bt.innerHTML = this.btnTxt;

        this.canvas.appendChild(ip);
        this.canvas.appendChild(bt);

        var self = this;
        hal.env.addEvent(bt, "click", function() { self.exeSearch(); });
    },
    exeSearch: function() {
        this.broadcast("onsearch", this.inputBox.value);
    }
});